package org.cbioportal.application.file.model;

import java.util.SequencedMap;

/** Represents metadata for a cancer study. */
public class CancerStudyMetadata implements StudyRelatedMetadata {
  /**
   * The cancer type abbreviation, e.g., "brca". This should be the same cancer type as specified in
   * the meta_cancer_type.txt file, if available. The type can be "mixed" for studies with multiple
   * cancer types.
   */
  private String typeOfCancer;

  /**
   * A string used to uniquely identify this cancer study within the database, e.g.,
   * "brca_joneslab_2013".
   */
  private String cancerStudyIdentifier;

  /** The name of the cancer study, e.g., "Breast Cancer (Jones Lab 2013)". */
  private String name;

  /**
   * A description of the cancer study, e.g., "Comprehensive profiling of 103 breast cancer samples.
   * Generated by the Jones Lab 2013". This description may contain one or more URLs to relevant
   * information.
   */
  private String description;

  /** A relevant citation, e.g., "TCGA, Nature 2012". */
  private String citation;

  /**
   * One or more relevant pubmed ids (comma separated without whitespace). If used, the field
   * citation has to be filled, too.
   */
  private String pmid;

  /**
   * When using an authenticating cBioPortal, lists the user-groups that are allowed access to this
   * study. Multiple groups are separated with a semicolon ";". The study will be invisible to users
   * not in at least one of the listed groups, as if it wasn't loaded at all. e.g.,
   * "PUBLIC;GDAC;SU2C-PI3K". see User-Authorization for more information on groups.
   */
  private String groups;

  private Boolean addGlobalCaseList;

  /**
   * The study reference genome (e.g. hg19, hg38). Without specifying this property, the study will
   * be assigned to the reference genome specified in application.properties (property ucsc.build).
   */
  private String referenceGenome;

  public String getTypeOfCancer() {
    return typeOfCancer;
  }

  public void setTypeOfCancer(String typeOfCancer) {
    this.typeOfCancer = typeOfCancer;
  }

  public String getCancerStudyIdentifier() {
    return cancerStudyIdentifier;
  }

  public void setCancerStudyIdentifier(String cancerStudyIdentifier) {
    this.cancerStudyIdentifier = cancerStudyIdentifier;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public String getCitation() {
    return citation;
  }

  public void setCitation(String citation) {
    this.citation = citation;
  }

  public String getPmid() {
    return pmid;
  }

  public void setPmid(String pmid) {
    this.pmid = pmid;
  }

  public String getGroups() {
    return groups;
  }

  public void setGroups(String groups) {
    this.groups = groups;
  }

  public String getReferenceGenome() {
    return referenceGenome;
  }

  public void setReferenceGenome(String referenceGenome) {
    this.referenceGenome = referenceGenome;
  }

  public Boolean getAddGlobalCaseList() {
    return addGlobalCaseList;
  }

  public void setAddGlobalCaseList(Boolean addGlobalCaseList) {
    this.addGlobalCaseList = addGlobalCaseList;
  }

  @Override
  public SequencedMap<String, String> toMetadataKeyValues() {
    var metadata = StudyRelatedMetadata.super.toMetadataKeyValues();
    metadata.put("type_of_cancer", getTypeOfCancer());
    metadata.put("name", getName());
    metadata.put("description", getDescription());
    metadata.put("citation", getCitation());
    metadata.put("pmid", getPmid());
    metadata.put("groups", getGroups());
    metadata.put(
        "add_global_case_list",
        getAddGlobalCaseList() == null ? null : getAddGlobalCaseList().toString());
    metadata.put("reference_genome", getReferenceGenome());
    return metadata;
  }
}
